package com.blb.zy_community.mapper;

import com.blb.zy_community.entity.SysRoleMenu;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mysql.cj.log.Log;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 角色和菜单关联表 Mapper 接口
 * </p>
 *
 * @author 二组
 * @since 2023-06-18
 */
@Mapper
public interface SysRoleMenuMapper extends BaseMapper<SysRoleMenu> {
    /**
     * 添加菜单
     * @param roleId
     * @param menuIds
     */
    @Insert("insert into sys_role_menu(role_id,menu_id) values(#{roleId},#{menuIds})")
    void addSysRoleMenu(Long roleId , String menuIds);

    /**
     * 根据角色id查询菜单
     */
    @Select("select menu_id from sys_role_menu where role_id = #{roleId}")
    List<Long> selectMenuByRoleId(Long roleId);
}
